/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author antonio
 */
@Embeddable
public class ProductionPK implements Serializable {

    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "resource")
    private String resource;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "construct")
    private String construct;

    public ProductionPK() {
    }

    public ProductionPK(String resource, String construct) {
        this.resource = resource;
        this.construct = construct;
    }

    public String getResource() {
        return resource;
    }

    public void setResource(String resource) {
        this.resource = resource;
    }

    public String getCivilBuild() {
        return construct;
    }

    public void setCivilBuild(String construct) {
        this.construct = construct;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (resource != null ? resource.hashCode() : 0);
        hash += (construct != null ? construct.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProductionPK)) {
            return false;
        }
        ProductionPK other = (ProductionPK) object;
        if ((this.resource == null && other.resource != null) || (this.resource != null && !this.resource.equals(other.resource))) {
            return false;
        }
        if ((this.construct == null && other.construct != null) || (this.construct != null && !this.construct.equals(other.construct))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.ProductionPK[ resource=" + resource + ", civilBuild=" + construct + " ]";
    }
    
}
